package view 
{

	import salomon.loader.TextureLoader;
	import salomon.manager.TextureManager;
	import starling.core.Starling;
	import starling.display.MovieClip;
	import starling.display.Sprite;
	import starling.events.EnterFrameEvent;
	import starling.events.Event;
	import starling.events.TouchEvent;
	import starling.textures.Texture;
	import starling.textures.TextureAtlas;
	
	/**
	 * ...
	 * @author Tiago Salomon
	 */
	public class SoldierView extends Sprite 
	{			
		private var movie		:MovieClip;
		private var tm:TextureManager;
		
		public function SoldierView(tm:TextureManager) 
		{
			this.tm = tm;
			this.addEventListener(Event.ADDED_TO_STAGE, initialize);
		}
		
		private function initialize(e:Event):void 
		{			
			
			movie = new MovieClip(tm.getItem("Hero").getTextures("run"), 30);			
			
			addChild(movie);
			
			Starling.juggler.add(movie);
			
			this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
			
		}
		
		private function onEnterFrame(e:Event):void 
		{
			this.movie.x += 3;
		}
		
		public function walkTo(x:uint, y:uint):void 
		{
			this.x = x;
			this.y = y;
		}
				
	}

}